<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui, viewport-fit=cover">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>My App</title>
    <link rel="stylesheet" href="../../packages/core/css/framework7.min.css">
    <link rel="stylesheet" href="../../css/framework7-icons.css">
  </head>
  <body>
    <div id="app"></div>
    <template id="app-template">
      <f7-app>
        <f7-view main>
          <f7-page>
            <f7-navbar title="Sortable List">
              <f7-nav-right>
                <f7-link sortable-toggle=".sortable">Toggle</f7-link>
              </f7-nav-right>
            </f7-navbar>
      
            <f7-block>
              <p>Just click "Toggle" button on navigation bar to enable/disable sorting</p>
            </f7-block>
            <f7-list sortable @sortable:sort="onSort">
              <f7-list-item
                title="1 Jenna Smith"
                after="CEO">
                <f7-icon icon="demo-list-icon" slot="media"></f7-icon>
              </f7-list-item>
              <f7-list-item
                title="2 John Doe"
                after="Director">
                <f7-icon icon="demo-list-icon" slot="media"></f7-icon>
              </f7-list-item>
              <f7-list-item
                title="3 John Doe"
                after="Developer">
                <f7-icon icon="demo-list-icon" slot="media"></f7-icon>
              </f7-list-item>
              <f7-list-item
                title="4 Aaron Darling"
                after="Manager">
                <f7-icon icon="demo-list-icon" slot="media"></f7-icon>
              </f7-list-item>
              <f7-list-item
                title="5 Calvin Johnson"
                after="Accounter">
                <f7-icon icon="demo-list-icon" slot="media"></f7-icon>
              </f7-list-item>
              <f7-list-item
                title="6 John Smith"
                after="SEO">
                <f7-icon icon="demo-list-icon" slot="media"></f7-icon>
              </f7-list-item>
              <f7-list-item
                title="7 Chloe"
                after="Manager">
                <f7-icon icon="demo-list-icon" slot="media"></f7-icon>
              </f7-list-item>
            </f7-list>
            <f7-list media-list sortable @sortable:sort="onSort">
              <f7-list-item
                title="Yellow Submarine"
                after="$15"
                subtitle="Beatles"
                text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
                >
                <img slot="media" src="http://lorempixel.com/160/160/people/1" width="80" />
              </f7-list-item>
              <f7-list-item
                title="Don't Stop Me Now"
                after="$22"
                subtitle="Queen"
                text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
                >
                <img slot="media" src="http://lorempixel.com/160/160/people/2" width="80" />
              </f7-list-item>
              <f7-list-item
                title="Billie Jean"
                after="$16"
                subtitle="Michael Jackson"
                text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
                >
                <img slot="media" src="http://lorempixel.com/160/160/people/3" width="80" />
              </f7-list-item>
            </f7-list>
          </f7-page>
        </f7-view>
      </f7-app>
      
    </template>
    <style>
      .demo-list-icon, .icon-f7 {
        background: #ccc;
        display: block;
        position: relative;
      }
      .ios .demo-list-icon, .ios .icon-f7, .ios .icon-vi {
        width: 29px;
        height: 29px;
        border-radius: 6px;
        box-sizing: border-box;
      }
      .md .demo-list-icon, .md .icon-f7, .md .icon-vi {
        width: 24px;
        height: 24px;
        border-radius: 4px;
      }
      
    </style>
    <script>
      var component = {
        methods: {
          onSort(e) {
            // Sort data
            console.log(e.target);
            console.log(e.detail);
          }
        }
      }
    </script>
    <script src="../../packages/vue/vue.min.js"></script>
    <script src="../../packages/vue/framework7-vue.min.js"></script>
    <script src="../../packages/core/js/framework7.min.js"></script>
    <script>
      var theme = 'ios';
      if (location.href.indexOf('theme=md') >= 0) theme = 'md';
      
      if (Framework7.use) Framework7.use(Framework7Vue, { theme: theme });
      else if (Framework7.Class && Framework7.Class.use) Framework7.Class.use(Framework7Vue, { theme: theme });
      
      var plugin = {
        params: {
          theme: theme,
        }
      };
      
      if (Framework7.use) Framework7.use(plugin);
      else if (Framework7.Class && Framework7.Class.use) Framework7.Class.use(plugin);
      
      if (typeof component === 'undefined') {
        var component = {};
      }
      if (typeof routes === 'undefined') {
        var routes = [];
      }
      component.el = '#app';
      component.template = '#app-template';
      
      new Vue(component);
    </script>
  </body>
</html>